<?php
namespace app\servercertificate\validate;
use \app\manage\validate\BaseValidate;

class TransferLog extends BaseValidate
{
    
	protected $rule =   [
        'id' => ['integer','gt'=>0],
        'name' => ['length'=>'2,25'],
        'certificate_id' => ['integer','gt'=>0],
        'user_id'  => ['integer','gt'=>0],
        'to_user'  => ['integer','gt'=>0,'different'=>'user_id'],
        'user_info'  => ['array','min'=>1],
        'to_user_info'  => ['array','min'=>1],
        'status'  => ['in'=>'0,1,2,3'],
        'type'  => ['in'=>'common,advanced'],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50]
    ];

    protected $message  =   [
        'id' => '没有要选择的元素',
        'certificate_id' => '证书id为大于0的整数',
        'user_id' => '用户user_id为大于0的整数',
        'to_user' => '用户to_user为大于0的整数,且不可等于user_id',
        'user_info' => '请传入持有人信息',
        'to_user_info' => '请传入转向人信息',
        'status' => '0 待处理 1 同意转让 2 拒绝转让 3 取消转让',
        'page' => '当前页为大于0的整数',
        'listRows' => '每页显示的条数范围为1-50',
    ];

    protected $scene = [
        'checkId' => ['id'],
        'checkIds' => ['id' => ['array','min'=>1 ] ],
        /*转让证书时检验用户信息*/
        'checkUserInfo' => [
            'name'=>['require','length'=>'2,25'],
        ],
        'transfer'=>[
            'certificate_id','user_id','to_user','user_info'=>['require','array','min'=>1],'to_user_info'=>['require','array','min'=>1]
        ],
        'transferCertiList' => [
            'page'=>['require','integer','gt'=>0],
            'listRows', 
            'user_id'=>['integer','egt'=>0],
            'to_user'=>['integer','egt'=>0, 'different'=>'user_id'],
            'type',
            'status' => ['in'=>'0,1,2,3'],
        ],
        'transferDirect' => ['certificate_id','user_id','to_user','type'=>['in'=>'transfer,sell']]
    ];

}